"""
将十进制数转换为二进制数
"""
from data_structure.stack.stacks import Stack


class Solution:

    @staticmethod
    def convert(decimal_num):
        stack = Stack()

        while decimal_num > 0:
            residue = decimal_num % 2
            stack.push(str(residue))
            decimal_num = decimal_num // 2

        binary_str = ""
        while not stack.is_empty():
            binary_str += stack.pop()

        return binary_str if binary_str else 0
